﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DeploymentMaxLib
{
    public class ActionLog
    {
        public string Log { get; set; }
        public DateTime? Created { get; set; }
        public ActionLogLevelType Level { get; set; }
        public ActionLog()
        {
        }


        public ActionLog(string pLog)
        {
            this.Log = pLog;
            this.Created = DateTime.Now;
            this.Level = ActionLogLevelType.None;
            Console.WriteLine(string.Format("{0}: {1}", Created, Log));
        }

        public ActionLog(string pLog, ActionLogLevelType pLevel)
        {
            this.Log = pLog;
            this.Created = DateTime.Now;
            this.Level = pLevel;
            Console.WriteLine(string.Format("{0}: {1}", Created, Log));
        }

        public ActionLog(string pValue, params object[] args)
        {
            this.Log = string.Format(pValue, args);
            this.Created = DateTime.Now;
            this.Level = ActionLogLevelType.None;
            Console.WriteLine(string.Format("{0}: {1}", Created, Log));
        }

        public ActionLog(string pValue, ActionLogLevelType pLevel, params object[] args)
        {
            this.Log = string.Format(pValue, args);
            this.Created = DateTime.Now;
            this.Level = pLevel;
            Console.WriteLine(string.Format("{0}: {1}", Created, Log));
        }



        public static ActionLog New(string pLog)
        {
            return new ActionLog(pLog);
        }

        public static ActionLog New(string pLog, ActionLogLevelType pLevel)
        {
            return new ActionLog(pLog, pLevel);
        }

        public static ActionLog New(string pValue, params object[] args)
        {
            return new ActionLog(string.Format(pValue, args));
        }

        public static ActionLog New(string pValue, ActionLogLevelType pLevel, params object[] args)
        {
            return new ActionLog(string.Format(pValue, args), pLevel);
        }

 
    }
}
